UNKNOWN
UNKNOWN = 0
Abstract class for accessing mail messages storage server
$conn : mixed
Instance of connection object e.g. rcube_imap_generic
$folder_types : array
List of supported special folder types
$icache : array
Internal (in-memory) cache
$all_headers : array
All (additional) headers used (in any way) by Roundcube Not listed here: DATE, FROM, TO, CC, REPLY-TO, SUBJECT, CONTENT-TYPE, LIST-POST (used for messages listing) are hardcoded in rcube_imap_generic::fetchHeaders()
connect(string $host, string $user, string $pass, int $port = 143, string $use_ssl = null) : bool
Connect to the server
string | $host | Host to connect |
string | $user | Username for IMAP account |
string | $pass | Password for IMAP account |
int | $port | Port to connect to |
string | $use_ssl | SSL schema (either ssl or tls) or null if plain connection |
True on success, False on failure
count(string $folder = null, string $mode = 'ALL', bool $force = false, bool $status = true) : int
Get messages count for a specific folder.
string | $folder | Folder name |
string | $mode | Mode for count [ALL|THREADS|UNSEEN|RECENT|EXISTS] |
bool | $force | Force reading from server and update cache |
bool | $status | Enables storing folder status info (max UID/count), required for folder_status() |
Number of messages
list_messages(string $folder = null, int $page = null, string $sort_field = null, string $sort_order = null, int $slice) : array
Public method for listing headers.
string | $folder | Folder name |
int | $page | Current page to list |
string | $sort_field | Header field to sort by |
string | $sort_order | Sort order [ASC|DESC] |
int | $slice | Number of slice items to extract from result array |
Indexed array with message header objects
index(string $folder = null, string $sort_field = null, string $sort_order = null) : \rcube_result_index|\rcube_result_thread
Return sorted list of message UIDs
string | $folder | Folder to get index from |
string | $sort_field | Sort column |
string | $sort_order | Sort order [ASC, DESC] |
List of messages (UIDs)
search(string $folder = null, string $str = 'ALL', string $charset = null, string $sort_field = null) : mixed
Invoke search request to the server.
string | $folder | Folder name to search in |
string | $str | Search criteria |
string | $charset | Search charset |
string | $sort_field | Header field to sort by |
get_message_headers(mixed $uid, string $folder = null, bool $force = false) : \rcube_message_header
Return message headers object of a specific message
mixed | $uid | |
string | $folder | Folder to read from |
bool | $force | True to skip cache |
Message headers
get_message_part(int $uid, string $part = 1, \rcube_message_part $o_part = null, mixed $print = null, resource $fp = null, bool $skip_charset_conv = false) : string
Fetch message body of a specific message from the server
int | $uid | Message UID |
string | $part | Part number |
\rcube_message_part | $o_part | Part object created by get_structure() |
mixed | True to print part, resource to write part contents in |
|
resource | $fp | File pointer to save the message part |
bool | $skip_charset_conv | Disables charset conversion |
Message/part body if not printed
get_raw_body(int $uid, resource $fp = null, string $part = null) : string
Returns the whole message source as string (or saves to a file)
int | $uid | Message UID |
resource | $fp | File pointer to save the message |
string | $part | Optional message part ID |
Message source string
set_flag(mixed $uids, string $flag, string $folder = null, bool $skip_cache = false) : bool
Set message flag to one or several messages
mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
string | $flag | Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
string | $folder | Folder name |
bool | $skip_cache | True to skip message cache clean up |
Operation status
unset_flag(mixed $uids, string $flag, string $folder = null) : bool
Remove message flag for one or several messages
mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
string | $flag | Flag to unset: SEEN, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
string | $folder | Folder name |
Operation status
save_message(string $folder, string|array $message, string $headers = '', bool $is_file = false, array $flags = [], mixed $date = null) : int|bool
Append a mail message (source) to a specific folder.
string | $folder | Target folder |
string|array | $message | The message source string or filename or array (of strings and file pointers) |
string | $headers | Headers string if $message contains only the body |
bool | $is_file | True if $message is a filename |
array | $flags | Message flags |
mixed | $date | Message internal date |
Appended message UID or True on success, False on error
move_message(mixed $uids, string $to, string $from = null) : bool
Move message(s) from one folder to another.
mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
string | $to | Target folder |
string | $from | Source folder |
True on success, False on error
copy_message(mixed $uids, string $to, string $from = null) : bool
Copy message(s) from one mailbox to another.
mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
string | $to | Target folder |
string | $from | Source folder |
True on success, False on error
expunge_message(mixed $uids, string $folder = null, bool $clear_cache = true) : bool
Expunge message(s) and clear the cache.
mixed | $uids | Message UIDs as array or comma-separated string, or '*' |
string | $folder | Folder name |
bool | $clear_cache | False if cache should not be cleared |
True on success, False on error
list_folders_subscribed(string $root = '', string $name = '*', string $filter = null, string $rights = null, bool $skip_sort = false) : array
Get a list of subscribed folders.
string | $root | Optional root folder |
string | $name | Optional name pattern |
string | $filter | Optional filter |
string | $rights | Optional ACL requirements |
bool | $skip_sort | Enable to return unsorted list (for better performance) |
List of folders
list_folders(string $root = '', string $name = '*', mixed $filter = null, string $rights = null, bool $skip_sort = false) : array
Get a list of all folders available on the server.
string | $root | IMAP root dir |
string | $name | Optional name pattern |
mixed | $filter | Optional filter |
string | $rights | Optional ACL requirements |
bool | $skip_sort | Enable to return unsorted list (for better performance) |
Indexed array with folder names
create_folder(string $folder, bool $subscribe = false, string $type = null, bool $noselect = false) : bool
Create a new folder on the server.
string | $folder | New folder name |
bool | $subscribe | True if the new folder should be subscribed |
string | $type | Optional folder type (junk, trash, drafts, sent, archive) |
bool | $noselect | Make the folder \NoSelect folder by adding hierarchy separator at the end (useful for server that do not support both folders and messages as folder children) |
True on success, False on error
mod_folder(string $folder, string $mode = 'out') : string
Modify folder name according to namespace.
For output it removes prefix of the personal namespace if it's possible. For input it adds the prefix. Use it before creating a folder in root of the folders tree.
string | $folder | Folder name |
string | $mode | Mode name (out/in) |
Folder name
get_metadata(string $folder, array $entries, array $options = [], bool $force = false) : array
Returns folder metadata/annotations (GETMETADATA/GETANNOTATION).
string | $folder | Folder name (empty for server metadata) |
array | $entries | Entries |
array | $options | Command options (with MAXSIZE and DEPTH keys) |
bool | $force | Disables cache use |
Metadata entry-value hash array on success, NULL on error